home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 #32
/
q32side2.d64
/
t.klondike jones
< prev
next >
Wrap
Text File
|
2022-08-30
|
10KB
|
204 lines
K L O N D I K E J O N E S
Program by Fender Tucker and Maurice Jones
Text by Fender Tucker
There's no copyright notice on KLONDIKE JONES because I have decided to
release this program into the public domain. I hope you will make copies
of the program and its associated files and spread them far and wide, so
that every C-128 user will now have a modern-looking, mouse-driven Klondike
solitaire game just like all of the Windows people do.
The two main tools used in the program, Jon Mattson's CONTROL80-C and
Maurice Randall's MOUSE80, were commissioned by LOADSTAR 128 and are
supplied with complete documentation, with the hopes that you 128
programmers out there will be inspired to use them to make more solitaire
card games for the 80-column screen. I WANT you to use the tools. All I
ask is that you mention in your program that you got them from LOADSTAR
128.
This program REQUIRES a proportional mouse in Port #1. There is no
keyboard or joystick control. If someone wants to add them, it's fine with
me. In fact, if you do a good job, send it to me and I'll put it on a
future LS 128.
FINALLY, KLONDIKE JONES
-----------------------
The solitaire is straight Klondike, with very few bells and whistles.
You must have a mouse in Port #1 to use the program. When you boot the
program a hand will be dealt and you will be asked for your name. Once you
enter it, a file with a "kj." prefix will be kept on the disk with your
scores in it. If you want to change names, QUIT the program and run it
again. If you want to keep the same name but clear the scores, scratch the
"kj." file. You are only asked for your name once, at the beginning of the
program.
Once the game has started, move the pointer to the card you want to
move and press the left button. You'll hear a "ding" and the pointer will
change to a box. Then move the pointer to where you want to move the card
to and press the left button again. If the card can move, it will be
moved, and if not, you'll hear a buzzer.
Is there anyone who DOESN'T know how to play KLONDIKE solitaire? The
tableaux are dealt with an increasing number of cards dealt face down in
the seven tableau piles, then covered with one face up card each. The
foundations, which are to be built from ace to king according to suit, are
at the top right-center of the screen. The deck is at the top left with
the waste pile to its immediate right. The tableaux are to be built DOWN
in alternately colored suits.
You may move a card from waste to tableau, waste to foundation, tableau
to foundation or tableau to tableau. An empty tableau pile may only be
filled with a king. You must move a whole tableau column; you cannot move
just one or some of the face-up cards. If you move all of the cards to the
foundations, you win.
You can double click on a tableau or waste pile to play the card to the
foundation.
Another thing you might want to change is line 1824. If you take out
the REM in that line it will cause the program to show you how many down
cards are in each tableau pile. It's not pretty, but it might be something
you like.
OPTIONS
-------
KLONDIKE JONES has some buttons at the top of the screen. Here's what
they do:
DEAL - Click on this when the game is lost and your score will be updated
(on disk, so leave the disk in the drive) and a new game will be dealt.
YOUR SCORES - Click on this to see your cumulative scores. You'll see the
current game's score, total number of games, total number of wins, and the
average number of cards played to the foundation per game. Try for an
average of 13 or more.
CLAIM WIN - Click on this when you are sure that you have the game won but
don't feel like moving all of the cards to the foundations. You'll get
credit for 52 cards played. This will only work if you've got all of the
tableau cards showing. Even if only one tableau card is still face-down,
the CLAIM won't work.
INFO - Click here to see a message from me proclaiming this program in the
public domain and challenging 128 programmers to use the tools to create
more solitaire games like this one.
TURN 1 - Click here to change the game so that one card at a time is dealt
from the deck, rather than the default three. The button will change to
TURN 3, which will return you back to flipping three cards if you click on
it. In other words, the button reflects the mode you can change to, not
the current mode in force.
QUIT - Click here, and if there's a LOADSTAR 128 disk in the drive,
LOADSTAR 128 will be booted. Otherwise, the program puts you back in
BASIC.
TIPS FOR PROGRAMMING WITH CONTROL80-C WITH MOUSE80
--------------------------------------------------
Print out the docs files for both of the tools and keep them for
reference. You don't need to use all of the commands, POKEs and SYSes that
are available but there are some that you will undoubtedly need.
I recommend using lines 10 through 120 just as they are in KLONDIKE
JONES. These lines load the tools and sets up the colors and fonts, and
initializes the mouse (restricting its movement to the size of the
screen).
I used the logic from Maurice Jones' OUR OWN KLONDIKE (from LS #120)
and then modified it to work on the 80-column screen and with the mouse.
You may want to simply use the code for KLONDIKE JONES and get rid of the
routines that aren't needed for your particular program. Here are some
that are very handy. You can probably improve upon these if you try.
Lines 600-630: The Button Definer - Here, in a two-dimensional array
p(i,j), the boundaries of each clickable area is read from DATA statements.
Each "button" has four parameters (or pieces of information): top left x
coordinate, top left y coordinate, bottom right x coordinate, bottom right
y coordinate. The cards are 8x6 character rectangles but I made the second
y coordinate for the tableau piles larger so that you can click anywhere on
a pile (even below it) and the program will recognize the correct pile. The
options button (the top line of the screen) have 0 for both y coordinates,
indicating that those buttons are only one row tall.
Lines 1840-1858: The Mouse Get Loop -
1840 sysmo+9
1842 sysmo+15
1850 xm=peek(mo+35):ym=peek(mo+36)
1851 ifpeek(mo+45)<192then1842
1852 sysmo+15:ifpeek(mo+45)>191then1852
1856 gosub200:goto1862:rem brancher subroutine
1858 goto1842
1862 program continues after button press
SYSMO+9 shows the mouse, then SYSMO+15 tracks the mouse pointer. Line
1850 gives you the x and y coordinates of the pointer when the SYSMO+15
command was last encountered. Lines 1851 and 1852 were suggested by
Maurice Randall to allow for slow mouses or heavy-handed button pushers.
Line 1856 checks to see if the left button was pressed, and if so, takes
you to the Brancher subroutine at 200.
Lines 200-226: The Brancher - This subroutine will take the x and y
coordinates of the mouse pointer (xm and ym) and give you the number of the
button pointed to (ft). In KLONDIKE JONES there are 26 possible buttons.
If the pointer is not on a button, then ft=-1.
It's a good idea to always hide the mouse before anything is drawn on the
screen. Technically, this is only necessary when something is being
printed in the area where the mouse pointer is, but how can you know where
the mouse will be? Just to be safe put SYSMO+6 before ANY command that
changes the screen and SYSMO+9 after, to turn the pointer back on.
Jon Mattson's CARD command makes displaying cards easy but you have to
be careful about printing a card so low on the screen that it extends past
the bottom of the screen. Generally the card will "wraparound" and the
bottom of the card will show up at the top of the screen. In KLONDIKE
JONES if you have a tableau pile that extends from King down to Deuce, the
bottom part of the deuce card will wrap around to the top row. Since the
program automatically redraws the option line at the top of the screen, you
never see this blip. Be careful in your program not to allow the program
to print below the bott